home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 …ember: Reference Library / Dev.CD Dec 97 RL.toast / What's New / Development Kits / TEC 1.2.1 / Sample Code / UnicodeHub / UnicodeHub ReadMe < prev    next >
Encoding:
Text File  |  1997-09-24  |  3.9 KB  |  47 lines  |  [TEXT/ttxt]

  1. What is UnicodeHub?
  2. I wrote this Application about a year ago to quickly test changes to the Unicode Converter.  Later, I put in support for the Text Encoding Converter but it is minimal.  UnicodeHub show cases the Unicode Converter.  It will use the Unicode Converter whenever possible even if the Text Encoding Converter can handle the same conversion.
  3.  
  4. The application is written using PowerPlant.  I needed a way to get a decent User Interface going as quickly as possible and PowerPlant provided a great framework.  Please ignore the PowerPlant code itself.  I do not pretend to be a good PP code programmer so please ignore it.  If you wish to make suggestions or changes to the code to enhance it, please send me those comments and I'll implement them.  
  5.  
  6. The code is in two files:  UnicodeHub.cp and Convert.cp.  Most of the interesting bits are in Convert.cp.  However, UnicodeHub.cp does have some important TEC usage tips in it.  
  7.  
  8. While looking at the code search for the following:
  9. TEC SPECIFIC CODE COMMENT
  10. You'll find comments related to using the converter.
  11.  
  12. What can you expect to learn from UnicodeHub?
  13. This application exercises almost every feature of the Unicode Converter.  It does not use the Truncate APIs or the offset parameters in the Convert calls.  What it shows you is:
  14.   *  Getting a list of all the available encodings and its names
  15.   *  Converting from Text Edit Styled text to Unicode and back
  16.        - This shows you how to go from the world of Script Codes to Text Encodings
  17.   *  Use of the CJK language hint corporate characters
  18.   *  How to determine if an encoding is Unicode
  19.   *  Use of standard or UTF-8 formatted Unicode
  20.   *  Simple use of the Text Encoding Converter
  21.       - Converting Text
  22.       - Flushing internal buffers
  23.   *  Unicode conversion flag usage
  24.   *  Output buffer allocation
  25.       -  Minumum buffer sizes
  26.       -  How to handle errors dealing with output buffers being too small
  27.  
  28. How to use the UnicodeHub?
  29. First and foremost, if you want to see the nice features of UnicodeHub, install multiple Language Kits into your machine.  However, it is not required to have any Language Kits installed.
  30.  
  31. The App displays a window with two places to enter text.  On top of each of the text field, you can specify the encoding for the text you are entering and for the text that will be converted.  The first one is "Styled Text".  If you select this, you can only perform conversions to Unicode.  Otherwise, UnicodeHub will complain.
  32.  
  33. Anytime you convert something to Unicode, the output will be in Hex.  The reason is simple.  We have no way to render that Unicode stream.  That is why the Text Encoding Converter is here.  If you convert styled text to Unicode, the Unicode output stream will show you how the different MacEncodings match the Unicode stream.  This is done by switching each run from blue to red.
  34.  
  35. Converting a Unicode stream to styled text also works.  Make sure that you select the Text Run and Keep Same Encoding check box.  Otherwise, your text might not convert.  When the conversion takes place, it selects the preferred Application Font for the target script.  So, don't alarm yourself if your text does not have the original font that you started with.  However, the text must be identical to whatever you started with.
  36.  
  37. Whenever you convert something, UnicodeHub will try to find a font that can render the output Text Encoding.  If it cannot, then it will select the default Application font and set the typeface of the font to bold.
  38.  
  39.  
  40. How do you build UnicodeHub?
  41. You'll need CW 11 with PowerPlant installed.  In the same folder, you'll need the TextCommon, UnicodeConverter, and TextEncodingConverter stublibraries ( aliases to those files will also do).  You'll also need to have TextCommon.h, UnicodeConverter.h, and TextEncodingConverter.h in the same folder.  Once again, aliases will do.
  42.  
  43. Julio González
  44. Text Utilities Group
  45. International, Text & Graphics
  46. juliog@apple.com
  47.